<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册</title>
</head>
<style>
    body {
        font-family: Arial, sans-serif;
        background-color: #f9f9f9;
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        /* 增加顶部空白区域 */
        padding-top: 30px;
    }
    .container {
        background-color: #ffffff;
        padding: 20px 40px;
        border-radius: 8px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        width: 100%;
        max-width: 400px;
    }
    h2 {
        text-align: center;
        margin-bottom: 20px;
        color: #333333;
    }
    label {
        display: block;
        margin-top: 15px;
        font-weight: bold;
        color: #555555;
    }
    input, textarea, select {
        width: 100%;
        padding: 10px;
        margin-top: 5px;
        border: 1px solid #cccccc;
        border-radius: 4px;
        font-size: 14px;
    }
    textarea {
        resize: none;
        height: 100px;
    }
    button {
        width: 100%;
        padding: 10px;
        margin-top: 20px;
        background-color: #4CAF50;
        color: #ffffff;
        border: none;
        border-radius: 4px;
        font-size: 16px;
        cursor: pointer;
    }
    button:hover {
        background-color: #45a049;
    }
    .error {
        color: red;
        font-weight: bold;
        font-size: 14px;
        margin-top: 10px;
    }
    .back-btn {
        width: 100%;
        padding: 10px;
        margin-top: 10px;
        background-color: #f44336;
        color: #ffffff;
        border: none;
        border-radius: 4px;
        font-size: 16px;
        cursor: pointer;
    }
    .back-btn:hover {
        background-color: #e53935;
    }
</style>
<body>
<div class="container">
    <h2>用户注册</h2>
    <form action="/teammember-register" method="post">
        <label for="username">用户名：</label>
        <input type="text" id="username" name="username" required>

        <label for="password">密码：</label>
        <input type="password" id="password" name="password" required>

        <label for="confirmPassword">确认密码：</label>
        <input type="password" id="confirmPassword" name="confirmPassword" required>

        <label for="email">邮箱：</label>
        <input type="email" id="email" name="email" required>

        <label for="phoneNumber">手机号：</label>
        <input type="text" id="phoneNumber" name="phoneNumber" required>

        <!-- 美化后的申请理由文本框 -->
        <label for="applicationReason">申请理由：</label>
        <textarea id="applicationReason" name="applicationReason" required></textarea>

        <!-- 密保问题 -->
        <label for="securityQuestion">密保问题:</label>
        <select id="securityQuestion" name="securityQuestion" required>
            <option value="你的第一只宠物的名字是什么？">你的第一只宠物的名字是什么？</option>
            <option value="你的母亲的姓名是什么？">你的母亲的姓名是什么？</option>
            <option value="你就读的小学叫什么名字？">你就读的小学叫什么名字？</option>
        </select>

        <!-- 密保答案 -->
        <label for="securityAnswer">密保答案:</label>
        <input type="text" id="securityAnswer" name="securityAnswer" required>

        <!-- 用户身份选择 -->
        <label for="roleType">用户角色:</label>
        <select id="roleType" name="roleType" required>
            <option value="2">团队成员</option>
            <option value="3">普通用户</option>
        </select>

        <button type="submit">提交注册申请</button>
    </form>

    <!-- 显示错误信息 -->
    <c:if test="${not empty error}">
        <div class="error">
                ${error}
        </div>
    </c:if>

    <!-- 弹出提示信息 -->
    <c:if test="${not empty message}">
        <script type="text/javascript">
            alert("${message}");
        </script>
    </c:if>

    <!-- 返回登录按钮 -->
    <button class="back-btn" onclick="window.location.href='/login.jsp'">返回登录</button>
</div>
</body>
</html>
